/*
 * @Author: 卢景滔
 * @Date: 2021-12-21 10:11:50
 * @LastEditTime: 2021-12-21 14:45:16
 * @LastEditors: 卢景滔
 * @Description: 子线程
 */

// 接收主线程信息
self.addEventListener('message', (e) => {
  const res = e.data
  switch (res.cmd) {
    case 'to child':
      console.log('子线程收到主线程信息：', res.data)
      postMessage({ cmd: 'to father', data: 'I am fine, father.' })
      break
  }
})
